Encoding apparatus and method

ABSTRACT

An encoding apparatus includes an image capture unit configured to capture an image through a lens; a characteristic determination unit configured to determine characteristics of the image based on a difference between a predetermined region where characteristics of the lens influence image quality and another region; a size determination unit configured to determine, based on the characteristics of the image, a block size used to divide a target block included in the image; a division unit configured to divide the target block into a plurality of blocks based on the determined block size; and a prediction coding unit configured to encode the plurality of blocks.

BACKGROUND

1. Field of the Invention

The present invention relates to an encoding apparatus and an encodingmethod.

2. Description of the Related Art

There are conventionally known an image capture apparatus, a mobilecommunication apparatus, and the like as encoding apparatuses forperforming compression/prediction coding of moving image data. The imagecapture apparatus or the mobile communication apparatus acquires amoving image signal based on an image captured by an image capture unit,performs compression coding of the acquired moving image signal, andrecords the thus obtained signal in a storage medium.

As a technique of performing compression coding of a moving imagesignal, there is conventionally proposed a technique of performingcompression coding of a moving image signal into a format such as MPEG,MPEG2, or H.264/AVC. Such compression coding technique is used for, forexample, a recording apparatus for recording a television broadcastprogram. Japanese Patent Laid-Open No. 2010-288080 discloses a techniqueof changing a threshold for determining the size of a DCT block inaccordance with genre information of a broadcast program.

If, however, the same process is applied within one screen as describedin Japanese Patent Laid-Open No. 2010-288080, when coding images havingdifferent image qualities within the one screen, the coding efficiencymay decrease.

SUMMARY

According to an aspect of the present invention, there is provided animproved technique or new technique of coding an image.

According to an aspect of the present invention, there is provided anencoding apparatus comprising: an image capture unit configured tocapture an image through a lens; a characteristic determination unitconfigured to determine characteristics of the image based on adifference between a predetermined region where characteristics of thelens influence image quality and another region; a size determinationunit configured to determine, based on the characteristics of the image,a block size used to divide a target block included in the image; adivision unit configured to divide the target block into a plurality ofblocks based on the determined block size; and a prediction coding unitconfigured to encode the plurality of blocks.

Further features and aspects of the present invention will becomeapparent from the following description of exemplary embodiments.

BRIEF DESCRIPTION OF THE DRAWINGS

FIG. 1 is a block diagram showing an example of an arrangement of anencoding apparatus according to a first exemplary embodiment;

FIG. 2 is a table showing an example of a table indicatingcharacteristics of an input image based on a type of lens according tothe first exemplary embodiment and a second exemplary embodiment;

FIG. 3A to FIG. 3C2 are views for explaining an example of lenscharacteristics in a region of an image according to the first exemplaryembodiment and the second exemplary embodiment;

FIG. 4 is a view for explaining an example of an input image divisionmethod according to the first exemplary embodiment and the secondexemplary embodiment;

FIG. 5 is a flowchart illustrating an example of a block divisionprocess according to the first exemplary embodiment;

FIG. 6 is a block diagram showing an example of an arrangement of anencoding apparatus according to the second exemplary embodiment; and

FIG. 7 is a flowchart illustrating an example of a block changingprocess according to the second exemplary embodiment.

DESCRIPTION OF THE EMBODIMENTS

Exemplary embodiments, features, and aspects of the present inventionwill be described in below with reference to the drawings.

Note that each functional block described in the following exemplaryembodiments need not always be an individual hardware component. Thatis, for example, the functions of some functional blocks may be executedby one hardware component. Alternatively, several hardware componentsmay cooperate with each other to execute the function or functions ofone or a plurality of functional blocks. The function of each functionalblock may be executed by a program loaded into a memory by a CPU(Central Processing Unit).

First Exemplary Embodiment

FIG. 1 is a block diagram showing an example of an arrangement of anencoding apparatus according to the first exemplary embodiment. Theencoding apparatus generates a coded stream by dividing an input imageinto blocks having a variable size, and performing prediction coding,and records the generated coded stream. Note that the encoding apparatusaccording to the first exemplary embodiment is capable of acting as atleast one of a mobile phone, PDA (Personal Digital Assistant), smartphone, and tablet PC each having a camera function, or at least one of adigital camera and digital video camera. Respective blocks of theencoding apparatus shown in FIG. 1 except for physical devices such as alens and image sensor may be implemented with hardware using dedicatedlogic circuits and memories. Alternatively, the respective blocks may beimplemented with software by causing a computer such as a CPU (CentralProcessing Unit) to execute processing programs stored in a memory tocontrol the operation of the apparatus.

In the first exemplary embodiment, a camera apparatus including a lensand image sensor will be exemplified as an encoding apparatus. However,any apparatus which includes a prediction coding unit and determines ablock size to be used in the process by the prediction coding unitaccording to lens information pertaining to a coding target image may beused.

<Coding Process>

The arrangement of an encoding apparatus and a coding process executedby the apparatus according to the first exemplary embodiment will bedescribed. A lens 101 captures, from the outside, light reflected by anobject, and outputs the light to a sensor 102 while outputting theinformation of the lens to a lens characteristic determination unit 112.The lens characteristic determination unit 112 determines thecharacteristics of an input image based on the type of the attached lens101. More specifically, the lens characteristic determination unit 112notifies a block size determination unit 116 of a region, of the inputimage, where the lens characteristics appear. The block sizedetermination unit 116 determines a block size for coding process foreach region based on the characteristics of each region sent by the lenscharacteristic determination unit 112 and the features of each region ofimage data supplied by the sensor 102. The lens characteristics and theblock size will be described in detail later.

The sensor 102 includes an image sensor such as a CMOS or CCD, andconverts an object image obtained by receiving light through the lens101 into an image, and outputs the image to a block division unit 113,the block size determination unit 116, a motion search unit 110, and anintra-prediction unit. 117. The block division unit 113 divides theinput image into first coding blocks having the same size, and thendivides the first coding block into second coding blocks according to aninstruction of the block size determination unit 116.

The motion search unit 110 performs pattern matching using a codingtarget prediction block and a reference frame image held by a referenceframe holding unit 109 (to be described later). Based on a combinationwhose error in pattern matching is smallest, the motion search unit 110detects the motion vector of the prediction block in the input image.The motion vector of the prediction block calculated by the motionsearch unit 110 is output to a motion compensation unit 111. The motioncompensation unit 111 performs a prediction process for the predictionblock based on the reference frame image and the motion vector, therebygenerating a predicted image. The predicted image is output to adetermination unit 118. In the above motion search process, the size ofthe prediction block is determined. The intra-prediction unit 117selects one of a plurality of intra-prediction modes, whose codingefficiency is high, using pixels around the prediction block to be codedas a reference image, thereby generating a predicted image.

The determination unit 118 selects and determines a coding predictionmethod based on the output results of the intra-prediction unit 117 andthe motion compensation unit 111. For example, the determination unit118 can derive the inter-screen difference value between the codingtarget image and the predicted image calculated by the intra-predictionunit 117 for the coding target block and that between the coding targetimage and the predicted image generated by the motion compensation unit111, compare the difference values with each other, and select themethod which yields a smaller difference. Upon determining theprediction method, the determination unit 118 outputs the predictedimage generated by the selected method to a subtractor 103 and an adder108.

The subtractor 103 calculates a prediction error between the pixel valueof the prediction block of the input image and that of the predictedimage, and outputs the prediction error to an orthogonal transformationunit 104. The orthogonal transformation unit 104 transforms theprediction error into, for example, a discrete cosine coefficient foreach quantization block determined by the block size determination unit116. A quantization unit 105 quantizes the discrete cosine coefficientinput from the orthogonal transformation unit 104 for each quantizationblock determined by the block size determination unit 116.

An inverse quantization unit 106 and an inverse orthogonaltransformation unit 107 respectively perform inverse quantization andinverse orthogonal transformation for the quantization result of thequantization unit 105, thereby obtaining a decoded prediction error. Theadder 108 adds the decoded prediction error to the predicted image toobtain a locally decoded image as a result of local decoding. Thereference frame holding unit 109 holds, as a reference frame image, thelocally decoded image obtained by the adder 108. An arithmetic codingunit 114 performs entropy coding for the quantization result and themotion vector obtained by the motion compensation unit 111 for eachsecond coding block, and outputs the result to a storage medium 115 as astream.

<Lens Characteristic Notification Process>

A lens characteristic notification process according to the firstexemplary embodiment will be described. FIG. 2 shows an example of atable held by the lens characteristic determination unit 112 andindicating the relationship between the type of lens and thecharacteristics of each region. The encoding apparatus can hold thetable by registering, in advance, information about lenses which may beused. The information in the table can be updated according toinformation provided by the lens 101, or updated by the encodingapparatus by downloading data from the outside. By assuming a case inwhich the horizontal component of the input image is divided into “xequal parts” and the vertical component of the input image is dividedinto “y equal parts”, FIG. 2 shows the characteristics of each dividedpixel. The input image division method is as shown in FIG. 3A. The upperleft corner of the image is set as an origin, and a pixel at the originis represented by (0, 0). Each pixel has coordinate values in thehorizontal and vertical directions corresponding to a position in theimage. The x component of the coordinate values takes a value between 0and x−1, and the y component of the coordinate values takes a valuebetween 0 and y−1.

Examples of the lens are special lenses having a wide angle of fieldsuch as a 360° lens and fish-eye lens as well as a standard lens. Sincesuch special lens has a wide angle of field, a region under theinfluence of the lens characteristics, more specifically, a region wheredistortion or information loss occurs or the light amount isinsufficient may occur. In the table shown in FIG. 2, therefore, thecharacteristics of each region of the input image are set to one of aninformation loss region, light falloff region, and strong distortionregion according to the type of lens. The lens characteristicdetermination unit 112 refers to the table based on information aboutthe type of lens acquired from the lens 101, and notifies the block sizedetermination unit 116 of characteristic information corresponding tothe type of lens in use.

Note that a normal region 201 indicates a usable pixel region which hasno problem such as distortion, information loss, or light falloff. Aninformation loss region 202 indicates a pixel region where no light fromthe lens 101 enters the imaging plane of the sensor 102 and thus nosignificant information can be obtained. A light falloff region 203indicates a pixel region where light from the lens 101 enters theimaging plane of the sensor 102 but the light amount is insufficient. Astrong distortion region 204 indicates a pixel region where strongdistortion has occurred due to the structure of the lens. Note that theinformation loss region 202, light falloff region 203, and strongdistortion region 204 may be collectively referred to as “lenscharacteristic regions” hereinafter in the following exemplaryembodiments.

If the type of the lens 101 is “lens 1”, the lens characteristicdetermination unit 112 notifies the block size determination unit 116that all regions (0, 0) to (x−1, y−1) are “normal regions”. If the typeof the lens 101 is “lens 2”, the lens characteristic determination unit112 notifies the block size determination unit 116 that the regions (0,0) and (1, 0) are “light falloff regions” where the light amount issmall, and that the regions (2, 0) to (4, 0) are “strong distortionregions”, and then notifies the block size determination unit 116 ofpieces of information of the regions (5, 0) to (x−1, y−1).

If the type of the lens 101 is “lens 3”, the lens characteristicdetermination unit 112 notifies the block size determination unit 116that the regions (0, 0) to (2, 0) are “information loss regions” whereno light reaches the sensor 102, and that the regions (3, 0) and (4, 0)are “strong distortion regions”, and then notifies the block sizedetermination unit 116 of information of each of the regions (5, 0) to(x−1, y−1). If the type of the lens 101 is “lens 4”, the lenscharacteristic determination unit 112 notifies the block sizedetermination unit 116 that the regions (0, 0) to (2, 0) are strongdistortion regions, and that the regions (3, 0) and (4, 0) are normalregions, and then notifies the block size determination unit 116 ofpieces of information of the regions (3, 0) to (x−1, y−1).

A practical example of the above process will be explained withreference to FIGS. 3B1 to 3C2. FIG. 3B1 to 3C2 are views showing imagesrespectively captured by the standard lens and fish-eye lens, and thelens characteristics of each region. In FIG. 3B1, an image captured bythe standard lens is shown. In FIG. 3B2, the lens characteristics ofeach region of the image captured by the standard lens are shown. InFIG. 3C1, an image obtained by capturing the same scene as that shown inFIG. 3B1 using the fish-eye lens is shown. In FIG. 3C2, the lenscharacteristics of each region of the image captured by the fish-eyelens and shown in FIG. 3C1 are shown. Reference numerals 201 to 204denote the same components as those shown in FIG. 2.

When comparing of FIGS. 3B1 and 3C1 with each other, with respect to theimage captured by the fish-eye lens and shown in FIG. 3C1, an imagecapture region is reduced from the entire screen to a circular region,and no light can reach outside the image capture region. Furthermore,light falloff at the edges of the image capture region occurs, and theimage is distorted toward the upper or lower edge. Since the image shownin FIG. 3B1 has been captured by the standard lens, the lenscharacteristics shown in FIG. 3B2 indicate that all the regions of theimage are normal regions 201. On the other hand, since the image shownin FIG. 3C1 has been captured by the fish-eye lens, the lenscharacteristics shown in FIG. 3C2 indicate that regions outside theimage capture region reduced to the circular region are information lossregions 202, the edge regions of the image capture region are lightfalloff region 203 due to light falloff, and the upper and lower edgeregions of the image capture region are strong distortion regions 204due to the distorted image.

In the first exemplary embodiment, the fish-eye lens has been used. Asfor other lenses, each region of an input image is set as one of thenormal region 201, information loss region 202, light falloff region203, and strong distortion region 204 according to the type of lens,similarly to the fish-eye lens. The lens characteristic determinationunit 112 notifies the block size determination unit 116 of informationof each region by referring to the table according to the type of lens.

<Block Size Determination Process>

FIG. 4 is a view showing each block size determined by the block sizedetermination unit 116. First coding blocks 401 are obtained by equallydividing the input image into, for example, 64 vertical pixels×64horizontal pixels, and also called “LCUs (Largest Coding Units)”. Thecoding process using the first coding blocks 401 is executed in an orderfrom the upper left block to the lower right block.

Second coding blocks 402 are obtained by dividing the first coding block401 into smaller parts, correspond to actual coding target blocks, andare also called “CUs (Coding Units)”. Each second coding block 402 canhave a size of 64, 32, 16, or 8 pixels in either of the vertical andhorizontal directions. Similarly to the first coding blocks 401, thesecond coding blocks 402 are processed in an order from the upper leftblock to the lower right block. A motion compensation process, anintra-prediction process, an orthogonal transformation process, aquantization process, and an arithmetic coding process are executedwithin the second coding block.

Prediction blocks 403 are obtained by dividing the second coding block402 into smaller parts, and are units used when each of the motionsearch unit 110, motion compensation unit 111, and intra-prediction unit117 executes a process, and are called “PUs (Prediction Units)”. Eachprediction block 403 can have a size of 64, 32, 16, 8, or 4 pixels ineither of the vertical and horizontal directions. Note that for theprediction blocks 403, block patterns for motion search are sequentiallyselected based on the determined block size of the CUs. For example, thesize of the CUs is 2N× 2N, a block pattern having a size of 2N×2N, 2N×N,N×2N, or N×N is selected for the motion compensation process. For theintra-prediction process, a block pattern having a size of 2N×2N or N×N(N=4) is selected.

Quantization blocks 404 are obtained by dividing the second coding block402 into smaller parts, and are units used when each of the orthogonaltransformation unit 104 and the quantization unit 105 executes aprocess, and are also called “TUs (Transform Units)”. Each quantizationblock 404 can have a size of 32, 16, 8, or 4 pixels in either of thevertical and horizontal directions.

A block size determination process executed by the block sizedetermination unit 116 will be described with reference to a flowchartshown in FIG. 5. FIG. 5 is a flowchart illustrating an example of blocksize determination process of determining a size of the second codingblock and the quantization block, which is executed by the block sizedetermination unit 116. The block size determination process is executedfor each first coding block, and continued until the overall input imageis processed. The block size determination process corresponding to theflowchart can be implemented when the CPU functioning as the block sizedetermination unit 116 executes a corresponding program (stored in a ROMor the like).

In step S501, the block size determination unit 116 acquires lenscharacteristic information corresponding to the type of lens attached tothe encoding apparatus from the lens characteristic determination unit112. In step S502, the block size determination unit 116 determineswhether a processing target block includes a region (lens characteristicregion) belonging to a predetermined region where the lenscharacteristics influence the image quality. More specifically, theblock size determination unit 116 determines whether a region wherecharacteristics except for the normal region 201 appear as the lenscharacteristics is included. If only the normal region 201 is included(“NO” in step S502), the block size determination unit 116 advances tostep S506. On the other hand, if one of the information loss region 202,light falloff region 203, and strong distortion region 204 of the lenscharacteristic regions is included (“YES” in step S502), the block sizedetermination unit 116 advances to step S503. The block sizedetermination process is independently performed for each of the lenscharacteristic region and another region (the normal region 201) in theinput image.

In step S503, the block size determination unit 116 determines whetherall the lens characteristics included in the processing target blockindicate the value of the information loss region 202. If all the lenscharacteristics indicate the value of the information loss region 202(“YES” in step S503), the block size determination unit 116 advances tostep S504. Alternatively, if a value other than that of the informationloss region 202 is also included (“NO” in step S503), the block sizedetermination unit 116 advances to step S505.

In step S504, the block size of each of the second coding block and thequantization block is determined as a largest block size. Note that forthe second coding block, the block size (64 pixels×64 pixels) of thefirst coding block is determined as a largest block size. For thequantization block, a possible largest size is a size of 32 pixels×32pixels. In step S505, the features of the image of the processing targetblock are determined to discriminate between a complicated region (aregion including many high-frequency components) where degradation isunnoticeable and a flat region (a region including many low-frequencycomponents) where degradation is noticeable. In order to set differentquantization widths for the complicated region and the flat region, theblock size of each of the second coding block and the quantization blockis determined so that the complicated region and the flat region do notcoexist in the quantization block. In the case of the quantizationblock, for example, the largest size is 32 pixels×32 pixels. Therefore,the first coding block is divided into four parts. If the complicatedregion and the flat region coexist in the divided block, the block isfurther divided into four parts to separate the regions. On the otherhand, if the regions do not coexist, the block need not be furtherdivided. The aforementioned process is repeated within the range of anallowable block size so as to reduce coexistence of the complicatedregion and the flat region in the divided block as much as possible.Note that if the block size is too small, the coding amount increases.The allowable coexistence ratio may be set in advance. In this case, ifthe coexistence ratio in the divided blocks is lower than the allowablecoexistence ratio, it is not necessary to further perform a divisionprocess. In this case, the block size determination unit 116 determinesthe block size of each of the second coding block and the quantizationblock to be equal to or larger than a predetermined threshold Th1. Thethreshold Th1 can be set to, for example, 16 pixels×16 pixels. Note thatthe reason why such threshold is set is because the processing targetblock in step S505 includes a pixel with distortion, information loss,or light falloff, and thus performing a fine quantization process bysubdividing the blocks unnecessarily increases the coding amount.

In step S506, the block size determination unit 116 determines the blocksize of each of the second coding block and the quantization block.Similarly to step S505, the block size determination unit 116 repeatsthe process until the complicated region and the flat region do notcoexist in the divided blocks of the block. At this time, the block sizedetermination unit 116 determines the block size of each of the secondcoding block and the quantization block to be equal to or smaller than apredetermined threshold Th2. The threshold Th2 can be set to, forexample, 16 pixels×16 pixels. Note that the threshold Th2 may be thesame as or different from the threshold Th1. Note that the reason whysuch threshold is set is because the processing target block in stepS506 includes a normal pixel without distortion or the like, andperforming the fine quantization process by subdividing the block hasmerits, unlike step S505.

With the above-described processes, it is possible to reduce the codingamount by setting a large block size for the lens characteristic regionssuch as information loss region, light falloff region, and strongdistortion region in the input image. At the same time, it is possibleto finely adjust the coding amount by assigning a small block size to aregion except for the lens characteristic regions. Note that since eachblock includes one motion vector and one quantization parameter, if ablock size is made larger, it is possible to decrease the number ofmotion vectors and that of quantization parameters, as compared with acase in which a region is divided into smaller blocks, thereby reducingthe coding amount. On the other hand, by setting a small block size, itis possible to set a motion vector and quantization width correspondingto each block. As described above, by selecting a block size accordingto the features of the input image, the coding efficiency improves, anda coded stream with higher image quality can be generated.

Although the method of determining the size of a quantization block hasbeen mainly described in the first exemplary embodiment, the presentinvention is also applicable to a method of determining the size ofanother block such as a prediction block. For example, for a predictionblock, a plurality of block patterns are selected based on the secondcoding blocks. At the time of selecting the block patterns, a pattern inwhich a complicated region and a flat region coexist can be excluded toselect a pattern without coexistence.

Second Exemplary Embodiment

In the above-described first exemplary embodiment, the block sizedetermination unit 116 acquires lens characteristic information based onthe type of the attached lens 101 from the lens characteristicdetermination unit 112, and determines a block size in consideration ofthe features of an input image by referring to the lens characteristicinformation. To the contrary, in the second exemplary embodiment, ablock size determination unit 116 determines a block size based onfeatures of an input image without referring to lens characteristicinformation. After that, a block size changing unit 119 acquires lenscharacteristic information from a lens characteristic determination unit112, and changes the determined block size.

FIG. 6 is a block diagram showing an example of an arrangement of anencoding apparatus according to the second exemplary embodiment. Thelens characteristic determination unit 112 recognizes the type of anattached lens 101, and notifies the block size changing unit 119 of aregion, of a screen, where the characteristics of the attached lensappear. The lens characteristic detection method is the same as thatdescribed in the first exemplary embodiment.

The block size determination unit 116 divides an input image captured bya sensor 102 into a plurality of first coding blocks, a plurality ofsecond coding blocks, a plurality of prediction blocks, and a pluralityof quantization blocks, and notifies the block size changing unit 119 ofit. Division into the second coding blocks, prediction blocks, andquantization blocks are performed according to the features of theimage, similarly to the first exemplary embodiment. That is, thefeatures of the image of a processing target block are determined todiscriminate between a complicated region (a region including manyhigh-frequency components) where degradation is unnoticeable and a flatregion (a region including many low-frequency components) wheredegradation is noticeable. Each block is subdivided so that thecomplicated region and the flat region do not coexist as much aspossible. This makes it possible to set a quantization widthcorresponding to each region. Note that although the upper and lowerlimits of a block size have been set in the first exemplary embodiment,the block size is not limited according to a threshold in the secondexemplary embodiment.

The block size changing unit 119 changes the size of each of the secondcoding block, prediction block, and quantization block, which has beendetermined by the block size determination unit 116, using theinformation sent by the lens characteristic determination unit 112. Ablock size changing process of the block size changing unit 119 will bedescribed in detail later. A block division unit 113 divides the inputimage into blocks based on the block sizes sent by the block sizechanging unit 119, and provides the blocks to a processing block of thesucceeding stage.

<Block Size Changing Process>

The block size changing process executed by the block size changing unit119 will be described. The block size changing unit 119 acquires thesize information of each of the second coding block, prediction block,and quantization block from the block size determination unit 116. Theblock size changing unit 119 also acquires lens characteristicinformation based on the type of the lens 101 from the lenscharacteristic determination unit 112. The lens characteristicinformation is the same as that shown in FIG. 2. The block size changingunit 119 changes each block size based on the received lenscharacteristic information.

A practical changing method will be described with reference to aflowchart shown in FIG. 7. FIG. 7 is a flowchart illustrating an exampleof the block size changing process executed by the block size changingunit 119. The block size changing process is executed for each firstcoding block, and continued until the overall input image is processed.The block size changing process corresponding to the flowchart can beimplemented when, for example, a CPU (Central Processing Unit)functioning as the block size changing unit 119 executes a correspondingprogram (stored in a ROM or the like).

In step S701, the block size changing unit 119 acquires the block sizeof each of the second coding block, prediction block, and quantizationblock obtained from the block size determination unit 116. In step S702,the block size changing unit 119 acquires lens characteristicinformation from the lens characteristic determination unit 112. In stepS703, the block size changing unit 119 determines whether a block toundergo changing process belongs to a predetermined region (lenscharacteristic region) where the lens characteristics influence theimage quality. If the block corresponds to a region where the lenscharacteristics appear (“YES” in step S703), the block size changingunit 119 advances to step S704. On the other hand, if the blockcorresponds to a normal region 201 (“NO” in step S703), the block sizechanging unit 119 advances to step S707. The block size changing processis independently performed for each of the lens characteristic regionand another region (the normal region 201) in the input image.

In step S704, the block size changing unit 119 determines whether allthe first coding blocks to be processed correspond to information lossregions 202. If all the first coding blocks correspond to theinformation loss regions 202 (“YES” in step S704), the block sizechanging unit 119 advances to step S705. On the other hand, if a regionother than the information loss regions 202 is included, the block sizechanging unit 119 advances to step S706. In step S705, the block sizechanging unit 119 changes the block size of each of the second codingblock and quantization block to the largest block size. For the secondcoding block, for example, the block size changing unit 119 changes theblock size to that (64 pixels×64 pixels) of the first coding block. Forthe quantization block, the block size changing unit 119 changes theblock size to 32 pixels×32 pixels. In step S706, the block size changingunit 119 changes the block size of each of the second coding block andquantization block to be equal to or larger than a block sizecorresponding to a predetermined threshold Th1. In step S707, the blocksize changing unit 119 changes the block size of each of the secondcoding block and quantization block to be equal to or smaller than ablock size corresponding to a predetermined threshold Th2. In thisexample, each of the predetermined thresholds Th1 and Th2 can be set to,for example, 16 pixels×16 pixels. Note that the thresholds Th1 and Th2may be the same or different.

Note that as described in the first exemplary embodiment, the size of aprediction block is determined based on the size of the second codingblock, and thus it is only necessary to change the size of the secondcoding block. When selecting a plurality of block patterns for theprediction block based on the second coding blocks, a pattern in which acomplicated region and flat region coexist can be excluded to select apattern without coexistence.

As described above, even for a general block whose block size isdetermined by the block size determination unit 116 using the featuresof an image, the coding efficiency improves by adding the block sizechanging unit 119. Similarly to the first exemplary embodiment,therefore, it is possible to provide an encoding apparatus forgenerating a high-quality coded stream. In the second exemplaryembodiment, the size of the quantization block is selected using thelens characteristics. However, the present invention is also applicablewhen another block size is used.

Other Exemplary Embodiments

Exemplary embodiments of the present invention can also be realized by acomputer that executes a program stored in a storage medium (e.g.,non-transitory computer-readable storage medium) to perform thefunctions of one or more of the above-described embodiments of thepresent invention, and by a method performed by the computer of thesystem or apparatus by, for example, reading out and executing theprogram from the storage medium to perform the functions of one or moreof the above-described embodiments. The computer may comprise one ormore of a central processing unit (CPU), micro processing unit (MPU), orother circuitry, and may include a network of separate computers orseparate computer processors. The program may be provided to thecomputer, for example, from a network or the storage medium. The storagemedium may include, for example, one or more of a hard disk, arandom-access memory (RAM), a read only memory (ROM), a storage ofdistributed computing systems, an optical disk (such as a compact disc(CD), digital versatile disc (DVD), or Blu-ray Disc (BD)™), a flashmemory device, a memory card, and the like.

While the present invention is described with reference to exemplaryembodiments, it is to be understood that the present invention is notlimited to the exemplary embodiments. The scope of the following claimsis to be accorded the broadest interpretation so as to encompass allmodifications and equivalent structures.

This application claims the benefit of Japanese Patent Application No.2013-181562 filed Sep. 2, 2013, which is hereby incorporated byreference herein in its entirety.

What is claimed is:
 1. An encoding apparatus comprising: an imagecapture unit configured to capture an image through a lens; acharacteristic determination unit configured to determinecharacteristics of the image based on a difference between apredetermined region where characteristics of the lens influence imagequality and another region; a size determination unit configured todetermine, based on the characteristics of the image, a block size usedto divide a target block included in the image; a division unitconfigured to divide the target block into a plurality of blocks basedon the determined block size; and a prediction coding unit configured toencode the plurality of blocks.
 2. The encoding apparatus according toclaim 1, wherein the block size determined for the remaining regionincludes a block size smaller than a block size assigned to thepredetermined region.
 3. The encoding apparatus according to claim 1,wherein the block size determined for the predetermined region includesa block size larger than a block size assigned to the remaining region.4. The encoding apparatus according to claim 1, wherein thepredetermined region includes a region where information loss hasoccurred, and if the region where information loss has occurred occupiesthe image of the first block, the size determination unit determines theblock size as the first size.
 5. The encoding apparatus according toclaim 1, wherein the size determination unit determines the block sizeso as to separate a complicated region including many high-frequencycomponents from a flat region including many low-frequency components inthe image of the first block.
 6. The encoding apparatus according toclaim wherein the prediction coding unit includes: a predicted imagegeneration unit configured to generate a predicted image of a codingtarget block in the first block; and a processing unit configured toperform orthogonal transformation and quantization for a predictionerror between the predicted image and an image of the coding targetblock of the image, and wherein the size determination unit determinesthe size of the coding target block as the block size.
 7. The encodingapparatus according to claim 6, wherein the size determination unitfurther determines, as a size not larger than the block size of thecoding target block, a block size used as a processing unit by theprocessing unit.
 8. A method comprising: capturing an image through alens; determining characteristics of the image, the characteristics ofthe image are determined by discriminating between a predeterminedregion where characteristics of the lens influence image quality and aremaining region in the image; determining, based on the characteristicsof the image, a block size used to divide a target block included in theimage; dividing the target block into a plurality of blocks based on thedetermined block size; and prediction coding the plurality of blocks. 9.A non-transitory storage medium that stores a program causing a computerto execute a method, the method comprising: capturing an image through alens; determining characteristics of the image, the characteristics ofthe image are determined by discriminating between a predeterminedregion where characteristics of the lens influence image quality and aremaining region in the image; determining, based on the characteristicsof the image, a block size used to divide a target block included in theimage; dividing the target block into a plurality of blocks based on thedetermined block size; and prediction coding the plurality of blocks.